package sivan.观察者模式;

import sivan.domain.Student;

/**
 * Created by sivan on 2019/2/28.
 */
public class ObserverTest {

    public static void main(String[] args) {
        TeacherSubject subject = new TeacherSubject();
        StudentObserver observer = new StudentObserver(new Student("yqq",23,11),subject);
        StudentObserver observer1 = new StudentObserver(new Student("xiaowen",23,11),subject);
        StudentObserver observer2 = new StudentObserver(new Student("xiaolan",28,11),subject);
        StudentObserver observer3 = new StudentObserver(new Student("xiaojun",25,11),subject);
        subject.publishJob("早上好");

        observer1.delete();
        observer2.delete();

        subject.publishJob("要交作业啦");

        observer.delete();
        observer3.delete();
        subject.addObserver(observer1);
        subject.addObserver(observer2);
        subject.publishJob("你们两个过来一下");
    }
}
